/*
 *   auther: stoneBeast
 *   date:   2022/03/16
 *   instructions:  a Max7219 driver base on arduino
 *
 */
#include <Arduino.h>

const static uint8_t code [][3] {
    {254, 130, 254},
    {132, 254, 128},
    {242, 146, 158},
    {146, 146, 254},
    {30, 16, 254},
    {158, 146, 242},
    {254, 146, 242},
    {2, 2, 254},
    {254, 146, 254},
    {158, 146, 254}
};

class MyMax7219Control
{
private:
    int DIN;
    int CS;
    int CLK;
    void chooseMode(uint8_t mode, uint8_t data);
    void init();
    void start();
    void end();
public:
    MyMax7219Control(int CLK, int CS, int DIN);
    void insterDigit(uint8_t digit, uint8_t data);
    void printNum(int data);
    void clear();
    void on();
    void off();
    void isTestDisplay(uint8_t value);
    void setIntensity(uint8_t level);
    void setScanLimit(uint8_t limit);
    void setDecodeMode(uint8_t mode);
    void scrollNum(uint8_t num, float speed);
    void flxPoint(int point, uint8_t data);
};
